#include "Log/test.h"
#include "cpp-httplib/httplib.h"
#include <string>

#define LISTEN_PORT 8888

#include "mDNS/mdns_query_parse.h"
int main(int argc, char *argv[])
{
    testPrint();
    mdns_query_parse();

    httplib::Server svr;

    // 定义 POST 接口（处理 JSON）
    svr.Post("/login", [](const httplib::Request &req, httplib::Response &res) {
        if (req.has_param("username") && req.has_param("password"))
        {
            auto username = req.get_param_value("username");
            auto password = req.get_param_value("password");
            // 验证逻辑...
            res.set_content("Login successful: " + username, "text/plain");
        }
        else
        {
            res.status = 400;// Bad Request
        }
    });


    std::string str("Server started on port ");
    str += std::to_string(LISTEN_PORT);
    LogPrint(str);
    svr.listen("0.0.0.0", LISTEN_PORT);

    LogPrint("zhongji test");

    return 0;
}
